package algoritmoVoraz;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class ParDeSumaMin {
	
	
	public static void parDeSumaMin(int[] v) throws Exception{
		
		
		ArrayList<Integer> l = new ArrayList<Integer>();		
		
		if (v.length%2!=0) throw new Exception("el vector no es par");
		
		for(Integer i:v)
				l.add(i);		
		
		Collections.sort(l);
		
		for(int i=0; i<v.length/2;i++)
			System.out.println("("+l.get(i)+","+l.get(l.size()-i-1)+")");				
						
		
	}
	
	public static void main (String[] args){
		int[] v = {-1, 5,12 ,7 ,0 ,2 , -3 , 9 };
		
		try {
			parDeSumaMin(v);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
